<template>
  <div :style="{ color, backgroundColor: bgColor }" class="my-header">
    {{ title }}
  </div>
</template>

<script>
export default {
  props: {
    bgColor: {
      type: String,
      default: "",
    },
    color: {
      type: String,
      default: "#fff", // 默认值, 如果不传默认使用该值
    },
    title: {
      type: String,
      required: true, // 必须要传入
    },
  },
};
</script>

<style lang="less" scoped>
.my-header {
  height: 45px;
  line-height: 45px;
  text-align: center;
  background-color: #1d7bff;
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 2;
}
</style>